Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mktemp: prioritize TMPDIR over -p when using -t #4878

Merged
merged 1 commit into from
May 22, 2023

Conversation

cakebaker
Copy link
Contributor

This PR ensures that the TMPDIR env variable has a higher priority than -p when using -t.

$ TMPDIR=dir_a cargo run mktemp -t -p dir_b foo.XXXX
dir_a/foo.DAXt

Closes #4874

@cakebaker cakebaker force-pushed the mktemp_4874 branch 2 times, most recently from c0ea58a to 51bc937 Compare May 19, 2023 15:57
.env("TMPDIR", &pathname)
.arg("-t")
.arg("-p")
.arg("should_not_attempt_to_write_in_this_nonexisting_dir")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i love this trick ;)

@cakebaker
Copy link
Contributor Author

The latest push introduces the TMPDIR_ENV_VAR const to make it work with Windows' TMP env var. Previously, I hardcoded the usage of the TMPDIR env var.

@sylvestre sylvestre merged commit e5419ad into uutils:main May 22, 2023
@cakebaker cakebaker deleted the mktemp_4874 branch May 22, 2023 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mktemp: incorrect priority between TMPDIR & -p
2 participants